#include"logistics.h"
#include "Administrator.h"
#include "cashier.h"

int main(int argc,const char* argv[])
{
	load_data(ad_passwd,sizeof(ad_passwd),"ad.dat");							//管理员密码
	cnt_log = load_data(hou_qin,sizeof(hou_qin),"log.dat") / sizeof(Log);		//后勤信息
	cnt_vip = load_data(vip,sizeof(vip),"vip.dat") / sizeof(Vip);				//VIP信息
	load_data(&account,sizeof(account),"account.dat");							//账户信息
	cnt_good = load_data(goods,sizeof(goods),"goods.dat") / sizeof(Goods) ;			//商品信息
	
	for(;;) 
	{
		menu();

		switch(get_cmd('1','4'))
		{
		case '1': login_log(); break;
		case '2': cash_menu(); break;
		case '3': ad_menu(); break;
		case '4': 
			save_data(ad_passwd,sizeof(ad_passwd),"ad.dat");
			save_data(hou_qin,sizeof(Log)*cnt_log,"log.dat");
			save_data(vip,sizeof(Vip)*cnt_vip,"vip.dat");
			save_data(&account,sizeof(account),"account.dat");
			save_data(goods,sizeof(Goods)*cnt_good,"goods.dat");
			
			return 0;
		}
	}
}
